/**
 * count the num of 1
 * @param
 * @Date ：created in 2022/4/7 17:23
 * @return
 */
public class NumOf1 {
    public static void main(String[] args) {
        System.out.println(count(7));
    }
    public static int count(int num){
        int count=0;
        while (num!=0){
            num=num&(num-1);
            count++;
        }
        return count;
    }
}
